﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace Krilib.Control.Base
{
    public abstract class TimelineMouseControllableItem
    {
        /// <summary>
        /// Item Rectangle
        /// </summary>
        abstract public IEnumerable<Rectangle> ItemRect { get; }


        public Point ItemShiftOffset = new Point(0, 0);
        public IEnumerable<Rectangle> ItemActualRect
        {
            get
            {
                if (this.ItemRect == null) yield break;
                foreach (var ir in this.ItemRect)
                {
                    var r = ir;
                    r.X += this.ItemShiftOffset.X;
                    r.Y += this.ItemShiftOffset.Y;
                    yield return r;
                }
            }
        }

        virtual public string Helptip { get { return null; } }

        /// <summary>
        /// Mouse over
        /// </summary>
        virtual public void OnMouseOver(object sender, ChainedMouseEventArgs e)
        { e.Trapped = false; }

        /// <summary>
        /// Mouse move
        /// </summary>
        virtual public void OnMouseMove(object sender, ChainedMouseEventArgs e)
        { e.Trapped = false; }

        /// <summary>
        /// Mouse enter
        /// </summary>
        virtual public void OnMouseEnter(object sender, ChainedMouseEventArgs e)
        { e.Trapped = false; }

        /// <summary>
        /// Mouse leave
        /// </summary>
        virtual public void OnMouseLeave(object sender, ChainedMouseEventArgs e)
        { e.Trapped = false; }

        /// <summary>
        /// Click this
        /// </summary>
        virtual public void OnMouseClick(object sender, ChainedMouseEventArgs e)
        { e.Trapped = false; }

        /// <summary>
        /// Doubleclick This
        /// </summary>
        virtual public void OnMouseDoubleClick(object sender, ChainedMouseEventArgs e)
        {
            OnMouseClick(sender, e);
        }

        /// <summary>
        /// Mouse Down
        /// </summary>
        virtual public void OnMouseDown(object sender, ChainedMouseEventArgs e)
        { e.Trapped = false; }

        /// <summary>
        /// Mouse Up
        /// </summary>
        virtual public void OnMouseUp(object sender, ChainedMouseEventArgs e)
        { e.Trapped = false; }
    }
}
